package concurrency;

class Reporter implements Runnable {
    private CarQueue mCarQueue;

    public Reporter(CarQueue cq) {
        mCarQueue = cq;
    }

    @Override
    public void run() {
        try {
            while (!Thread.interrupted()) {
                System.out.println(mCarQueue.take());
            }
        } catch (InterruptedException e) {
            System.out.println("Exiting Reporter via interrupt");
            // e.printStackTrace();
        }
        System.out.println("Reporter off");
    }
}
